import React from "react";
// 在使用context的时候，类组件和函数组件的用法相同
import { Consumer } from "./App";

const Child = () => {
  return (
    <>
      <div>child组件</div>
      <Consumer>
        {(value) => (
          <>
            <button onClick={value.minus}>-</button>
            <span>{value.count}</span>
            <button onClick={value.add}>+</button>
          </>
        )}
      </Consumer>
    </>
  );
};

export default Child;
